<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function doCalculate(a,b,fn) {
        var m = fn(a,b);
        console.log(m);
    }

    doCalculate(2,7,function (x,y) {
        return x + y;
    });
</script>
</body>
</html>